package com.globallogic.capacitaciones.hibernate.dao;

import java.util.GregorianCalendar;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.globallogic.capacitaciones.hibernate.domain.Bid;

@Repository
public class BidDAOImpl extends AbstractDAO<Bid> implements BidDAO {

	@SuppressWarnings("unchecked")
	@Override
	public List<Bid> bidsByItemDescription(String itemDescription) {
		String query = "Select b From Item i,IN(i.bids) b where i.description = :itemDescription";

		List<Bid> bids = getSession().createQuery(query)
				.setParameter("itemDescription", itemDescription).list();
		return bids;
	}

	@Override
	public long quantityBidsByDay(long itemId, GregorianCalendar day) {
		return 0;
	}

}
